struct state {
	int *status;
	int status0_first;   /* the first previous state */
	int status0_last;    /* the last previous state */
	int status1_sibling; /* the sibling state of the current state */
	int status1;         /* current state */
	int status2;         /* next state */
	int final;           /* final status */
	int flux;            /* total flux through this state */
	int flux1;           /* flux through status1 -> status2 , = flux + 1 */
	int flux2;           /* the maximum flux through status0 -> status1 */
	int dist1;           /* number of timestep to the final steady state */
	int dist2;           /* number of timestep to the given trajectory */
	int basin;           /* basin size, only for steady state  */
	float overlap;       /* old overlap index defined by Chao */
	int flag;            /* -2 : temporary; -1 : undetermined ; 0 : normal state; 1 : steady state; 2 : normal state, final state is a cycle; 3 : cycle state */
};

int pack (int N, int status[N]);

void unpack (int p, int N, int status[N]);

/* setup the initial value */
void init_state (int N, int n, struct state state[n]);

/* reset the initial value */
void reset_state (int n, struct state state[n]);
                         	
/* generate the dynamics tree (status2, final, dist1, flag for each state is setup)*/
void generate_dynamics (int N, int network[N][N], int n, struct state state[n]);

/* calculate the total flux for each state */
void calc_flux (int N, int n, struct state state[n]);
